'href' => $this->getTitle()->getLocalURL() )
);
+ // Tell $wgOut the user arrived at this article through a redirect
+ $wgOut->setRedirectedFrom( $this->mRedirectedFrom );
+
return true;
}
} elseif ( $rdfrom ) {
'Cookie' => null
);
+ /**
+ * If the current page was reached through a redirect, $mRedirectedFrom contains the Title
+ * of the redirect.
+ *
+ * @var Title
+ */
+ private $mRedirectedFrom = null;
+
/**
* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will implicitly create
return $this->mHTMLtitle;
}
+ /**
+ * Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
+ *
+ * param @t Title
+ */
+ public function setRedirectedFrom( $t ) {
+ $this->mRedirectedFrom = $t;
+ }
+
/**
* "Page title" means the contents of \<h1\>. It is stored as a valid HTML fragment.
* This function allows good tags like \<sup\> in the \<h1\> tag, but not bad tags like \<script\>.
if ( $title->isMainPage() ) {
$vars['wgIsMainPage'] = true;
}
+ if ( $this->mRedirectedFrom ) {
+ $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBKey();
+ }
// Allow extensions to add their custom variables to the mw.config map.
// Use the 'ResourceLoaderGetConfigVars' hook if the variable is not